package com.ganxiang.ximenhong.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;

import com.ganxiang.ximenhong.R;
import com.ganxiang.ximenhong.base.BaseActivity;
import com.ganxiang.ximenhong.widght.LoadingDiaolg;
import com.ganxiang.ximenhong.widght.MyWebView;
import com.ganxiang.ximenhong.widght.RatingBarView;
import com.ganxiang.ximenhong.widght.StaticGridView;
import com.ganxiang.ximenhong.widght.StaticListView;

/**
 * Created by Administrator on 2016/9/14 0014.
 */
public class GoodsDetailActivity extends BaseActivity {

    private StaticListView mAppraiseLv;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_goods_detail);
        new LoadingDiaolg(this).show();
        init();
    }

    private void init() {
        setTitleBar(R.string.spxq);
        initAppriseLv();
        ((LinearLayout)findViewById(R.id.ll_webview)).addView(new MyWebView(this,"http://www.2345.com/tg21145.htm"));
    }

    private void initAppriseLv() {
        mAppraiseLv = (StaticListView) findViewById(R.id.lv_pingjia);
        mAppraiseLv.setAdapter(new AppriseLvAdapter());
    }
    class AppriseLvAdapter extends BaseAdapter{

        @Override
        public int getCount() {
            return 2;
        }

        @Override
        public Object getItem(int i) {
            return null;
        }

        @Override
        public long getItemId(int i) {
            return 0;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
            if(view == null){
                view = View.inflate(GoodsDetailActivity.this,R.layout.item_jingjia,null);
            }
            ((RatingBarView)view.findViewById(R.id.tv_rating)).setStar(4);
            StaticGridView gv = (StaticGridView) view.findViewById(R.id.gv);
            gv.setAdapter(new GvAdapter());
            return view;
        }
    }

    class GvAdapter extends  BaseAdapter{

        @Override
        public int getCount() {
            return 4;
        }

        @Override
        public Object getItem(int i) {
            return null;
        }

        @Override
        public long getItemId(int i) {
            return 0;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
            if(view == null){
                view = View.inflate(GoodsDetailActivity.this, R.layout.item_iv,null);
            }

            return view;
        }
    }
}
